home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / bipl.zip / PROCS.ZIP / GMEAN.ICN < prev    next >
Text File  |  1992-09-28  |  712b  |  29 lines

  1. ############################################################################
  2. #
  3. #    File:     gmean.icn
  4. #
  5. #    Subject:  Procedure to compute geometric mean
  6. #
  7. #    Author:   Gregg M. Townsend
  8. #
  9. #    Date:     November 10, 1990
  10. #
  11. ###########################################################################
  12. #
  13. #     This procedure computes the geometric mean of an arbitrary number of
  14. #  values. It fails if there are no arguments or if any argument is zero.
  15. #
  16. ############################################################################
  17.  
  18. procedure gmean(L[])
  19.    local m
  20.  
  21.    m := 1.0
  22.    every m *:= !L
  23.    m := abs(m)
  24.    if m > 0.0 & *L > 0 then
  25.       return exp (log(m) / *L)
  26.    else
  27.       fail
  28. end
  29.